package at.codejedi.sto.gui.combat;

import java.awt.GridBagLayout;

import javax.swing.JPanel;

import at.codejedi.sto.config.Configuration;
import at.codejedi.sto.model.combat.IBattleStatistic;

public class BattleStatisticsPanel extends JPanel {

	private static final long serialVersionUID = 3044809930011601298L;

	DamagePanel netDamagePanel;
	DamagePanel rawDamagePanel;

	public BattleStatisticsPanel() {
		GridBagLayout gbl_statisticsPanel = new GridBagLayout();
		gbl_statisticsPanel.columnWidths = new int[] { 308, 308, 0 };
		gbl_statisticsPanel.rowHeights = new int[] { 216, 0 };
		gbl_statisticsPanel.columnWeights = new double[] { 0.0, 0.0,
				Double.MIN_VALUE };
		gbl_statisticsPanel.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
		setLayout(gbl_statisticsPanel);

		netDamagePanel = new DamagePanel(
				Configuration.getLabel("Entry.NetDamage"));
		add(netDamagePanel);

		rawDamagePanel = new DamagePanel(
				Configuration.getLabel("Entry.RawDamage"));
		add(rawDamagePanel);
	}

	public void setStatistics(IBattleStatistic statistics) {
		netDamagePanel.setPerSecondDealt(statistics.getNetDamageDealt()
				.getDamagePerSecond());
		netDamagePanel.setPerSecondReceived(statistics.getNetDamageReceived()
				.getDamagePerSecond());
		netDamagePanel.setAllDealt(statistics.getNetDamageDealt()
				.getAllDamage());
		netDamagePanel.setAllReceived(statistics.getRawDamageReceived()
				.getAllDamage());

		rawDamagePanel.setPerSecondDealt(statistics.getRawDamageDealt()
				.getDamagePerSecond());
		rawDamagePanel.setPerSecondReceived(statistics.getRawDamageReceived()
				.getDamagePerSecond());
		rawDamagePanel.setAllDealt(statistics.getRawDamageDealt()
				.getAllDamage());
		rawDamagePanel.setAllReceived(statistics.getRawDamageReceived()
				.getAllDamage());
	}
}
